package com.zprmb.udzt.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.zprmb.udzt.BaseActivity;
import com.zprmb.udzt.MainActivity;
import com.zprmb.udzt.MainActivity2;
import com.zprmb.udzt.R;

/**
 * @author shenshao
 */

public class FailActivity2 extends BaseActivity implements View.OnClickListener {


    TextView tv_title;

    //返回按钮
    ImageView img_back;

    TextView text_fail;

    Button btn_invest;

    //到智投宝呢
    Button btn_jilu;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fail);
        tv_title = (TextView) findViewById(R.id.tv_title);
        tv_title.setText("投资结果");

        img_back = (ImageView) findViewById(R.id.img_back);
        img_back.setOnClickListener(this);
        text_fail = (TextView) findViewById(R.id.text_fail);
        text_fail.setText("失败原因:" + getIntent().getStringExtra("comment"));
        btn_invest = (Button) findViewById(R.id.btn_invest);
        btn_invest.setOnClickListener(this);
        btn_jilu = (Button) findViewById(R.id.btn_jilu);
        btn_jilu.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.img_back:
                finish();
                break;

            case R.id.btn_invest:
              /*  if (getIntent().getStringExtra("str_receive").equals(1)){
                    //跳转智投宝
                    MainActivity.newInstance().setCurrentTabByTag("tab_tag_dextrity");
                    SuccessActivity.this.finish();
                }else {

                }*/
                //跳转列表页面
//                MainActivity.newInstance().setCurrentTabByTag("tab_tag_dextrity");

                try {
                    MainActivity.newInstance().setCurrentTabByTag("tab_tag_dextrity");
                }catch (Exception e){

                }
                try {
                    MainActivity2.newInstance().setCurrentTabByTag("tab_tag_dextrity");
                }catch (Exception e){

                }
                FailActivity2.this.finish();
//                intent.putExtra("active_url", Constant.URL + "h5/currentDetail?isInvest=1&flagFresh=" + false + "&isFirstInvest=" + firstType + "&productType=" + "dexterity" + "&amount=" + amount + "&action=1&app=true&token=");
                break;

            case R.id.btn_jilu:
                Intent intent = new Intent(FailActivity2.this, V6WebviewChild_SuccessYue.class);
//                http://test1.udrmb.com/api/v2/queryFunds?type=INVEST&pageNo=1&pageSize=20
//                intent.putExtra("url", Constant.URL + "h5/currentDetail?action=1&isInvest=1");
//                MainActivity.newInstance().setCurrentTabByTag("tab_tag_zhanghu");
                try {
                    MainActivity.newInstance().setCurrentTabByTag("tab_tag_zhanghu");
                }catch (Exception e){

                }
                try {
                    MainActivity2.newInstance().setCurrentTabByTag("tab_tag_zhanghu");
                }catch (Exception e){

                }
                startActivity(intent);
                break;
        }
    }
}
